package designPattern.AdapterPattern;

import designPattern.AdapterPattern.saver.SDCard;
import designPattern.AdapterPattern.saver.TFCard;

/**
 * fileName: SDAdapter
 * description: ...
 * <p>
 * 创建SD适配TF （也可以说是SD兼容TF，相当于读卡器）：
 * 实现SDCard接口，并将要适配的对象作为适配器的属性引入。
 *
 * @author lihaogn-main
 * @version 1.0
 * @date 2019/9/18 21:05
 */
public class SDAdapterTF implements SDCard {

    private TFCard tfCard;

    public SDAdapterTF(TFCard tfCard) {

        this.tfCard = tfCard;
    }

    @Override
    public String readSD() {
        System.out.println("适配器读取tf卡");
        return tfCard.readTF();
    }

    @Override
    public int writeSD(String msg) {
        System.out.println("适配器写入tf卡");

        return tfCard.writeTF(msg);

    }
}
